<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
  <%@include file="inc/_header.jsp"%>
</head>
<body>
<c:set var="nav_login" value="true"></c:set>
<%@include file="inc/_nav.jsp"%>
<div class="container">
  <form id="mainForm">
    <table>
      <tr>
        <td>用户名:</td>
        <td>
          <input name="username" type="text" class="form-control"/>
        </td>
      </tr>
      <tr>
        <td>密 码:</td>
        <td>
          <input name="password" type="password" class="form-control"/>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          <input type="submit" class="btn btn-default" value="提交">
          没有账号?<a href="register.do">注册</a>
        </td>
      </tr>
    </table>
  </form>
</div>
<script>
  $(function(){
    $("#sendCheckcode").on("click",function(){
      var email = $("#email").val();
      var param = {};
      param.email = email;
      $.post("/email/sendEmailCheckcode.do",param,function(result){
        if(result.success){
          $("#sendCheckcode").hide();
        }else{
          alert("出错了("+result.msg+")");
        }
      },"json").error(function(){
        alert("系统错误,请稍后重试");
      });
    });
    $("#mainForm").submit(function(data){



      var param = $(this).serializeArray();
      $.post("/user/register.do?method=send",param,function(result){
        if(result.success){
          alert("注册成功");
        }else{
          alert("注册失败:"+result.msg);
        }
      },"json").error(function(){
        alert("系统错误,请刷新后重试");
      })
      return false;
    })

  })
</script>
</body>
</html>
